package cn.itcast.hotel.controller;


import cn.itcast.hotel.constant.HotelConstants;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class MqController {
    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("/hello")
    public String deliverMessage(@RequestParam("mg") String massage ){
        rabbitTemplate.convertAndSend(HotelConstants.HOTEL_EXCHANGE,HotelConstants.HOTEL_INSERT_KEY,massage);
        return "deliver success!";
    }
}
